package com.example.lay.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.TextView;

/**
 * Created by cuilei on 2014/12/10.
 */
public class MyRadioAndCheckActivity extends Activity {

    private RadioGroup rg;
    private TextView show;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_radio_check);
        rg = (RadioGroup) findViewById(R.id.rg);
        show = (TextView) findViewById(R.id.txtShow);
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                String showTxt = checkedId == R.id.rbMale ? "您的性别是男" : "您的性别是女";
                show.setText(showTxt);
            }
        });
    }
}
